import Axios from './Axios';
import { AxiosInstance } from './types'
import { CancleToken, isCancle } from './cancle';

function createInstance():AxiosInstance {
    let context: Axios = new Axios();
    let instance = Axios.prototype.request.bind(context); // request函数
    instance = Object.assign(instance, Axios.prototype, context)

    return instance as AxiosInstance;
}

let axios = createInstance();
axios.CancelToken = new CancleToken();
axios.isCancel = isCancle
export default axios;
export * from './types'